package mood.su.db;

import android.util.Log;

import java.io.File;

public class DataFileConfig {
    public static final String DATABASE_PATH = "/data/data/mood.su.mood/";
    public static final int DATABASE_VERSION = 1;

    public static boolean isDBFileExist() {
        String path = DATABASE_PATH + "databases" + File.separator;
        String DB_NAME = path + "DB.db";
        File file = new File(DB_NAME);
        long length = file.length();
        if (file.exists()) {

            if (length < 10240) {
                file.delete();
                return false;
            }
            return true;
        } else {
            return false;
        }
    }

    public static String getFilePath() {
        String path = DATABASE_PATH + "databases" + File.separator;
        String DB_NAME = path + "DB.db";
        Log.d("DATABASE_FILE", "create database file！");
        File dir = new File(path);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        return DB_NAME;
    }
}
